UREMOTE.PAS
unit Uremote;
interface
uses
Windows, Messages, SysUtils, Classes, Graphics, Controls, Forms, Dialogs,
StdCtrls, WinampCall,ShellAPI,registry;
type
TForm1 = class(TForm)
WinampCall1: TWinampCall;
Button1: TButton;
Button2: TButton;
Button3: TButton;
Button4: TButton;
Button5: TButton;
Button6: TButton;
Button7: TButton;
procedure Button1Click(Sender: TObject);
procedure Button2Click(Sender: TObject);
procedure Button3Click(Sender: TObject);
procedure Button4Click(Sender: TObject);
procedure Button5Click(Sender: TObject);
procedure Button6Click(Sender: TObject);
procedure Button7Click(Sender: TObject);
procedure Startup(Sender: TObject);
procedure FormDestroy(Sender: TObject);
private
{ Private declarations }
public
{ Public declarations }
end;
var
Form1: TForm1;
implementation
{$R *.DFM}
procedure TForm1.Button1Click(Sender: TObject);
begin
WinampCall1.Play;
end;
procedure TForm1.Button2Click(Sender: TObject);
begin
WinampCall1.Stop;
end;
procedure TForm1.Button3Click(Sender: TObject);
begin
WinampCall1.hide;
end;
procedure TForm1.Button4Click(Sender: TObject);
begin
WinampCall1.show;
end;
procedure TForm1.Button5Click(Sender: TObject);
begin
WinampCall1.Previous;
end;
procedure TForm1.Button6Click(Sender: TObject);
begin
WinampCall1.Next;
end;
procedure TForm1.Button7Click(Sender: TObject);
begin
WinampCall1.Pause;
end;
function ExecuteFile(const FileName, Params, DefaultDir: string;
ShowCmd: Integer): THandle;
var
zFileName, zParams, zDir: array[0..79] of Char;
begin
Result := ShellExecute(Application.MainForm.Handle, nil,
StrPCopy(zFileName, FileName), StrPCopy(zParams, Params),
StrPCopy(zDir, DefaultDir), ShowCmd);
end;
procedure TForm1.FormShow(Sender: TObject);
Var
R : TRegistry;
S : String;
WinampKey : String;
begin
if FindWindow('winamp v1.x',nil) = 0 then begin
WinampKey := 'Software\CLASSES\Winamp.File\DefaultIcon';
R := TRegistry.create;
R.RootKey := HKEY_LOCAL_MACHINE;
If R.KeyExists(WinampKey) then begin
R.OpenKey(WinampKey,False);
S := R.ReadString('');
S := Copy(S,1,Pos(',',S)-1);
ExecuteFile(S,'','',SW_HIDE);
end;
end
else
WinampCall1.hide;
end;
procedure TForm1.FormDestroy(Sender: TObject);
begin
WinampCall1.Show;
end;
end.
Copyright 1998 Rob Vonk